]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
slider: Use actor relative coordinates when dragging
authorCarlos Garnacho <carlosg@gnome.org>
Fri, 26 Sep 2025 02:42:47 +0000 (04:42 +0200)
committerCarlos Garnacho <carlosg@gnome.org>
Tue, 4 Nov 2025 17:55:32 +0000 (18:55 +0100)
Stop working on absolute coordinates here, this is not necessary.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3912>

js/ui/slider.js

index ede76cca501eb5c29c06ca2963b77628ef2cfad6..01bb7c8f88145b9a55e6f26dc15125861788cac8 100644 (file)
@@ -87,7 +87,7 @@ export const Slider = GObject.registerClass({
         // sure that no 'notify::value' signal is emitted before this one.
         this.emit('drag-begin');
 
-        const coords = this._panGesture.get_centroid_abs();
+        const coords = this._panGesture.get_centroid();
         this._moveHandle(coords.x, coords.y);
         return Clutter.EVENT_STOP;
     }
@@ -107,7 +107,7 @@ export const Slider = GObject.registerClass({
     }
 
     _onPanUpdate() {
-        const coords = this._panGesture.get_centroid_abs();
+        const coords = this._panGesture.get_centroid();
         this._moveHandle(coords.x, coords.y);
     }
 
@@ -161,13 +161,11 @@ export const Slider = GObject.registerClass({
         return super.vfunc_key_press_event(event);
     }
 
-    _moveHandle(absX, _absY) {
-        let relX;
-        const [sliderX] = this.get_transformed_position();
+    _moveHandle(x, _y) {
         const rtl = this.get_text_direction() === Clutter.TextDirection.RTL;
         const width = this._barLevelWidth;
 
-        relX = absX - sliderX;
+        let relX = x;
         if (rtl)
             relX = width - relX;